class Documenti::NoteController < DefaultController
  require_role [self.parent_name.underscore, :anagrafiche, :personale, :contabilita]
  active_scaffold :nota do |config|
    config.label = Application.controller_label(self)
    config.actions.add :field_search, :export
    ref = [ :nota_ref_type, :nota_ref ]
    columns = [ :data, :testo ]
    config.columns = columns
    config.field_search.columns = ref + columns + [ :nota_ref ]
    list.sorting = {:data => 'DESC'}
    config.subform.layout = :vertical
    config.columns[:nota_ref_type].label = "Tipo"
    config.columns[:nota_ref].label = "Riferimento"
    config.columns[:testo].options = NOTE_TEXTAREA
    [:testo, :data].each { |i| config.columns[i].inplace_edit = :ajax }
    config.action_links.add "Allegati", :action => 'nested', :parameters => {:associations => :allegati}, :type => :member
  end
end
